/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.orderlang.orderProduct.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.orderlang.orderProduct.domain.OrderDetailForProductVO;
import com.seeyoui.kensite.bussiness.orderlang.orderProduct.domain.OrderProduct;
import com.seeyoui.kensite.bussiness.orderlang.orderProduct.domain.OrderProductVO;
import com.seeyoui.kensite.bussiness.orderlang.orderProduct.persistence.OrderProductMapper;

/**
 * OrderProduct
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-02-07
 */

@Service
public class OrderProductService extends BaseService {
	
	@Autowired
	private OrderProductMapper orderProductMapper;
	
	/**
     * 订单详情界面商品列表数据展示
     * @param map
     * @return
     */
    public List<OrderDetailForProductVO> findOrderDetailForProduct(Map map){
        return orderProductMapper.findOrderDetailForProduct(map);
    }
	
	/**
	 * 查询订单商品列表
	 * @param map
	 * @return
	 */
	public List<OrderProductVO> findProductListByOrderId(Map map){
		return orderProductMapper.findProductListByOrderId(map);
	}

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public OrderProduct findOne(String id) throws CRUDException{
		return orderProductMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param orderProduct
	 * @return
	 * @throws CRUDException
	 */
	public List<OrderProduct> findList(OrderProduct orderProduct) throws CRUDException {
		return orderProductMapper.findList(orderProduct);
	}
	
	/**
	 * 查询所有数据集合
	 * @param orderProduct
	 * @return
	 * @throws CRUDException
	 */
	public List<OrderProduct> findAll(OrderProduct orderProduct) throws CRUDException {
		return orderProductMapper.findAll(orderProduct);
	}
	
	/**
	 * 查询数据总数
	 * @param orderProduct
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(OrderProduct orderProduct) throws CRUDException {
		return orderProductMapper.findTotal(orderProduct);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param orderProduct
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(OrderProduct orderProduct) throws CRUDException {
		return orderProductMapper.findExTotal(orderProduct);
	}
	
	/**
	 * 数据新增
	 * @param orderProduct
	 * @throws CRUDException
	 */
	public void save(OrderProduct orderProduct) throws CRUDException{
		orderProduct.preInsert();
		orderProductMapper.save(orderProduct);
	}
	
	/**
	 * 数据修改
	 * @param orderProduct
	 * @throws CRUDException
	 */
	public void update(OrderProduct orderProduct) throws CRUDException{
		orderProduct.preUpdate();
		orderProductMapper.update(orderProduct);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		orderProductMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param orderProduct
	 * @throws CRUDException
	 */
	public void remove(OrderProduct orderProduct) throws CRUDException{
		orderProduct.preUpdate();
		orderProductMapper.remove(orderProduct);			
	}
	
}